/*
 * Copyright (C) 2004, Velocityme Partnership
 * ChangeDeltaItemTypeBean.java
 *
 * Created on 14 July 2004, 01:41
 */

package com.velocityme.entity;

import javax.ejb.*;
import javax.naming.*;
import java.rmi.*;
import javax.rmi.*;
import com.velocityme.interfaces.*;
import com.velocityme.interfaces.ServiceUnavailableException;

/**
 *
 * @author  Robert
 * @ejb.bean
 *           type="CMP"
 *           cmp-version="2.x"
 *           name="ChangeDeltaItemType"
 *           jndi-name="ejb/ChangeDeltaItemType"
 *           view-type="local"
 * @ejb.transaction type="Required"
 *
 * @ejb.value-object match="*"
 *
 * @ejb.persistence table-name="changedeltaitemtype"
 *
 * @ejb.util generate="physical"
 *
 * @jboss.persistence create-table="true"
 *                    remove-table="false"
 */
public abstract class ChangeDeltaItemTypeBean implements EntityBean {
    
    public static final int FIRST_NAME = 0;
    public static final int LAST_NAME = 1;
    public static final int DESCRIPTION = 2;
    public static final int USERNAME = 3;
    public static final int NAME = 4;
    public static final int ADD_PERMISSION = 5;
    public static final int REMOVE_PERMISSION = 6;
    public static final int DEPARTMENT = 7;
    public static final int PERSON = 8;
    public static final int RECURSIVE = 9;
    public static final int NODE = 10;
    public static final int ROLE = 11;
    public static final int SPONSOR = 12;
    public static final int OWNER = 13;
    public static final int PRIMARY_CONTACT = 14;
    public static final int TASK_STATE = 15;
    public static final int ADD_CONTACT_DETAIL = 16;
    public static final int UPDATE_CONTACT_DETAIL = 17;
    public static final int REMOVE_CONTACT_DETAIL = 18;
    public static final int ADD_HYPERLINK = 19;
    public static final int UPDATE_HYPERLINK = 20;
    public static final int REMOVE_HYPERLINK = 21;
    public static final int ADD_TRANSITION = 22;
    public static final int UPDATE_TRANSITION = 23;
    public static final int REMOVE_TRANSITION = 24;
    public static final int ORGANISATION = 25;
    public static final int PARENT_NODE = 26;
    public static final int PRIORITY = 27;
    public static final int ADD_RESPONSIBILITY = 28;
    public static final int REMOVE_RESPONSIBILITY = 29;
    public static final int START_TIME = 30;
    public static final int STOP_TIME = 31;
    public static final int STATE = 32;
    public static final int STATUS = 33;
    public static final int TASKSTATEMACHINE = 34;
    public static final int ADD_INTERESTED_ROLE = 35;
    public static final int REMOVE_INTERESTED_ROLE = 36;
    public static final int CHILD_NODE = 37;
    public static final int DESTINATION_NODE = 38;
    public static final int ADD_INTERESTED_CONTACTABLE = 39;
    public static final int REMOVE_INTERESTED_CONTACTABLE = 40;
    public static final int MESSAGE = 41;
    public static final int DELETE_CHILD = 42;
    public static final int ADD_USER = 43;
    public static final int REMOVE_USER = 44;
    public static final int ENABLED = 45;
    public static final int CREATOR = 46;
    public static final int ACTIVE = 47;
    public static final int PERCENTAGE_COMPLETE = 48;
    public static final int EXPECTED_DURATION = 49;
    public static final int DATE = 50;
    public static final int RESPONSIBILITY = 51;
    public static final int JOB_TITLE = 52;
    public static final int DEPENDENCY_TASK = 53;
    public static final int DEPENDANT_TASK = 54;
    public static final int SCRUM_MASTER = 55;
    public static final int NUM_TYPES = 56;

    /**
    * Context set by container
    */
    private javax.ejb.EntityContext m_entityContext;

    public void setEntityContext(javax.ejb.EntityContext entityContext) {
        m_entityContext = entityContext;
    }

    public void unsetEntityContext() {
        m_entityContext = null;
    }
  
    /** @ejb.create-method */
    public ChangeDeltaItemTypePK ejbCreate(java.lang.Integer p_type) throws javax.ejb.CreateException {
        setChangeDeltaItemTypeId(p_type);
        // EJB 2.0 spec says return null for CMP ejbCreate methods.
        return null;
    }

    public void ejbPostCreate(java.lang.Integer p_type) throws javax.ejb.CreateException {
        // CMR relations must be set in ejbPostCreate
        String name;
        switch(p_type.intValue()) {
            case FIRST_NAME:                name = "First Name"; break;
            case LAST_NAME:                 name = "Last Name"; break;
            case DESCRIPTION:               name = "Description"; break;
            case USERNAME:                  name = "Username"; break;
            case NAME:                      name = "Name"; break;
            case ADD_PERMISSION:            name = "Add Permission"; break;
            case REMOVE_PERMISSION:         name = "Remove Permission"; break;
            case DEPARTMENT:                name = "Department"; break;
            case PERSON:                    name = "Person"; break;
            case RECURSIVE:                 name = "Recursive"; break;
            case NODE:                      name = "Node"; break;
            case ROLE:                      name = "Role"; break;
            case SPONSOR:                   name = "Sponsor"; break;
            case OWNER:                     name = "Owner"; break;
            case PRIMARY_CONTACT:           name = "Primary Contact"; break;
            case TASK_STATE:                name = "Task State"; break;
            case ADD_CONTACT_DETAIL:        name = "Add Contact Detail"; break;
            case UPDATE_CONTACT_DETAIL:     name = "Update Contact Detail"; break;
            case REMOVE_CONTACT_DETAIL:     name = "Remove Contact Detail"; break;
            case ADD_HYPERLINK:             name = "Add Hyperlink"; break;
            case UPDATE_HYPERLINK:          name = "Update Hyperlink"; break;
            case REMOVE_HYPERLINK:          name = "Remove Hyperlink"; break;
            case ADD_TRANSITION:            name = "Add Transition"; break;
            case UPDATE_TRANSITION:         name = "Update Transition"; break;
            case REMOVE_TRANSITION:         name = "Remove Transition"; break;
            case ORGANISATION:              name = "Organisation"; break;
            case PARENT_NODE:               name = "Parent Node"; break;
            case PRIORITY:                  name = "Priority"; break;
            case ADD_RESPONSIBILITY:        name = "Add Responsibility"; break;
            case REMOVE_RESPONSIBILITY:     name = "Remove Responsibility"; break;
            case START_TIME:                name = "Start Time"; break;
            case STOP_TIME:                 name = "Stop Time"; break;
            case STATE:                     name = "State"; break;
            case STATUS:                    name = "Status"; break;
            case TASKSTATEMACHINE:          name = "TaskStateMachine"; break;
            case ADD_INTERESTED_ROLE:       name = "Add Interested Role"; break;
            case REMOVE_INTERESTED_ROLE:    name = "Remove Interested Role"; break;
            case CHILD_NODE:                name = "Child Node"; break;
            case DESTINATION_NODE:          name = "Destination Node"; break;
            case ADD_INTERESTED_CONTACTABLE:name = "Add Interested Contactable"; break;
            case REMOVE_INTERESTED_CONTACTABLE:name = "Remove Interested Contactable"; break;
            case MESSAGE:                   name = "Message"; break;
            case DELETE_CHILD:              name = "Delete Child"; break;
            case ADD_USER:                  name = "Add User"; break;
            case REMOVE_USER:               name = "Remove User"; break;
            case ENABLED:                   name = "Enabled"; break;
            case CREATOR:                   name = "Creator"; break;
            case ACTIVE:                    name = "Active"; break;
            case PERCENTAGE_COMPLETE:       name = "Percentage Complete"; break;
            case EXPECTED_DURATION:         name = "Expected Duration"; break;
            case DATE:                      name = "Date"; break;
            case RESPONSIBILITY:            name = "Responsibility"; break;
            case JOB_TITLE:                 name = "Job Title"; break;
            case DEPENDENCY_TASK:           name = "Dependency Task"; break;
            case DEPENDANT_TASK:            name = "Dependant Task"; break;
            case SCRUM_MASTER:              name = "Scrum Master"; break;
            default:                        name = "Unknown ChangeDeltaItemType"; break;
        }
        setName(name);
    }
    
    /**
     *  This gets a local object from a remote object.
     *  @ejb.interface-method view-type="remote"
     */
    public ChangeDeltaItemTypeLocal getLocal() {
        return (ChangeDeltaItemTypeLocal)m_entityContext.getEJBLocalObject();
    }
    
    /** @ejb.interface-method view-type="local" */
    public abstract com.velocityme.valueobjects.ChangeDeltaItemTypeValue getChangeDeltaItemTypeValue();

    //=======================================================================
    //
    //                   ATTRIBUTES
    //
    //=======================================================================
      
    /**
     * @ejb.persistence column-name="changeDeltaItemTypeId"
     * @ejb.interface-method view-type="local"
     * @ejb.pk-field 
     */
    public abstract java.lang.Integer getChangeDeltaItemTypeId();
    public abstract void setChangeDeltaItemTypeId(java.lang.Integer changeDeltaItemTypeId);
    
    /**
     * @ejb.persistence column-name="name"
     * @ejb.interface-method view-type="local"
     */
    public abstract java.lang.String getName();
    public abstract void setName(java.lang.String name);
    
    //=======================================================================
    //
    //                   RELATIONSHIPS
    //
    //=======================================================================
    
    //=======================================================================
    //
    //                   MANAGEMENT METHODS
    //
    //=======================================================================
    
}
